
#include <mockcpp/mockcpp.hpp>
#include <testngpp/testngpp.hpp>
#include <string>
#include <sstream>
#include "Length.h"
#include "LengthDisplayFormat.h"


USING_MOCKCPP_NS
USING_TESTNGPP_NS

using namespace std;

FIXTURE(Length)			
{

        TEST(shoule be able to let 2 INCH length display 2 INCH)
        {
              InchUnitDisplay dispFormat;
              Length len(2, INCH, &dispFormat);
              stringstream ostr;
              ostr<<len;

              ASSERT_EQ( ostr.str(), "2 INCH");
        }

        TEST(shoule be able to let 2 FEET length display 24 INCH)
        {
              InchUnitDisplay dispFormat;
              Length len(2, FEET, &dispFormat);
              stringstream ostr;
              ostr<<len;              

              ASSERT_EQ( ostr.str(), "24 INCH");
        }

        TEST(shoule be able to let 3 YARD length display 108 INCH)
        {
              InchUnitDisplay dispFormat;
              Length len(3, YARD, &dispFormat);
              stringstream ostr;
              ostr<<len;

              ASSERT_EQ( ostr.str(), "108 INCH");
        }

        TEST(shoule be able to let 2 MILE length display 126720 INCH)
        {
              InchUnitDisplay dispFormat;
              Length len(2, MILE, &dispFormat);
              stringstream ostr;
              ostr<<len;

              ASSERT_EQ( ostr.str(), "126720 INCH");
        }


        TEST(shoule be able to let 5282 FEET length display 1 MILE 2 FEET)
        {
              CascadeUnitDisplay dispFormat;
              Length len(5282, FEET, &dispFormat);
              stringstream ostr;
              ostr<<len;

              //ASSERT_EQ( ostr.str(), "1 MILE 2 FEET");
        }


        TEST(shoule be able to let 35 INCH length display 2 FEET 11 INCH)
        {
              CascadeUnitDisplay dispFormat;
              Length len(35, INCH, &dispFormat);
              stringstream ostr;
              ostr<<len;

              ASSERT_EQ( ostr.str(), "2 FEET 11 INCH");
        }


        TEST(shoule be able to let 38 INCH length display 1 YARD 2 INCH)
        {
              CascadeUnitDisplay dispFormat;
              Length len(38, INCH, &dispFormat);
              stringstream ostr;
              ostr<<len;

              ASSERT_EQ( ostr.str(), "1 YARD 2 INCH");
        }

        TEST(shoule be able to let 48 INCH length display 1 YARD 1 FEET)
        {
              CascadeUnitDisplay dispFormat;
              Length len(48, INCH, &dispFormat);
              stringstream ostr;
              ostr<<len;

              ASSERT_EQ( ostr.str(), "1 YARD 1 FEET");
        }

        TEST(shoule be able to let 5 FEET length display 1 YARD 2 FEET)
        {
              CascadeUnitDisplay dispFormat;
              Length len(5, FEET, &dispFormat);
              stringstream ostr;
              ostr<<len;

              ASSERT_EQ( ostr.str(), "1 YARD 2 FEET");
        }

        TEST(shoule be able to let 1781 YARD length display 1 MILE 21 YARD)
        {
              CascadeUnitDisplay dispFormat;
              Length len(1781, YARD, &dispFormat);
              stringstream ostr;
              ostr<<len;

              ASSERT_EQ( ostr.str(), "1 MILE 21 YARD");
        }
 

        TEST(should be able to express 3 feet equal to 12 INCH plus 2 feet: 12 INCH + 2 feet == 3 feet is true)
        {
               Length lenInch12(12, INCH);
               Length lenFeet2(2, FEET);
               Length lenFeet3(3, FEET);

               ASSERT_TRUE(lenInch12 + lenFeet2 == lenFeet3);
        }

        TEST(should be able to express 1 mile equal to 1757 yard plus 3 feet: 1757 yard + 3 feet == 1 mile is true)
        {
               Length lenMile(1, MILE);
               Length lenYard(1759, YARD);
               Length lenFeet(3, FEET);

               ASSERT_TRUE(lenMile == lenYard + lenFeet);
        }
  
        TEST(should be able to express 1 mile equal to 1760 yards: 1 mile == 1760 yard is true)
        {

               Length lenMile(1, MILE);
               Length lenYard(1760, YARD);
    
               ASSERT_TRUE(lenMile == lenYard);
 
        }

        TEST(should be able to express 1 mile not equal to 1761 yards: 1 mile != 1761 yard is true)
        {
               Length lenMile(1, MILE);
               Length lenYard(1761, YARD);
    
               ASSERT_TRUE(lenMile != lenYard);
        }

        TEST(should be able to express 1 mile greater than 1760 yards: 1 mile > 1760 yards is false)
        {
               Length lenYard(1760, YARD);
               Length lenMile(1, MILE);

               ASSERT_FALSE(lenMile > lenYard);
        }

        TEST(should be able to express 1 mile less than 1760 yards: 1 mile < 1760 yards is false)
        {
               Length lenYard(1760, YARD);
               Length lenMile(1, MILE);

               ASSERT_FALSE(lenMile > lenYard);
        }

        TEST(should be able to express 1 mile equal to 5280 feet: 1 mile == 5280 feet is true)
        {
               Length lenFeet(5280, FEET);
               Length lenMile(1, MILE);

               ASSERT_TRUE(lenMile == lenFeet);
        }
   
      
         TEST(should be able to express 1 yard equal to 3 feet: 1 yard == 3 feet is true)
        {
  
               Length lenFeet(3, FEET);
               Length lenYard(1, YARD);

               ASSERT_TRUE(lenYard == lenFeet);
        }


};


